package com.diankangwo.factory.service.impl;

import com.diankangwo.factory.dao.TdCommodityCategoryMapper;
import com.diankangwo.factory.entity.TdCommodityCategory;
import com.diankangwo.factory.service.TdCommodityCategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service("TdCommodityCategoryService")
public class TdCommodityCategoryServiceImpl implements TdCommodityCategoryService {
    @Autowired
    TdCommodityCategoryMapper mapper;
    /**
     * 添加
     */
    @Transactional
    public void save(TdCommodityCategory tdCommodityCategory){
        mapper.insert(tdCommodityCategory);
    }

    /**
     * 删除
     * @param id
     */
    @Override
    @Transactional
    public void deleteByCommodityId(int id) {
        mapper.deleteByCommodityId(id);
    }

    @Override
    public List<TdCommodityCategory> selectByCommodityId(Integer commodityId) {
        return mapper.selectByCommodityId(commodityId);
    }

    @Override
    public int deleteByCategoryId(Integer id) {
        return mapper.deleteByCategoryId(id);
    }

    ;

}

